#lang racket

(define-struct pair (left right))

(define (our-cons a-value a-list)
  (cond
    [(or (pair? a-list) (empty? a-list))
     (make-pair a-value a-list)]
    [else (error 'our-cons "list as second argument expected!")]
    )
  )

(define (our-first a-pair)
  (pair-left a-pair)
  )

(define (our-rest a-pair)
  (pair-right a-pair)
  )



(define (add-up-list lst)
  (cond
    [(empty? (our-rest lst)) (our-first lst)]
    [else (+ (our-first lst) (add-up-list (our-rest lst)))]
    )
  )

; Test
(define a-lst
  (our-cons 1
    (our-cons 2
       (our-cons 3 empty)))
  )

(add-up-list a-lst)
